/*
 *  $Id: Mantara.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Water.Creatures {
    public class Mantara: CreatureCard {
        public Mantara(): base("001_w_c_mantara") {
            Level = CompleteLevel.ReadyForTest;
            Version = 0;
            Element = ElementType.Water;
            Value = 100;
            Damage = 2;
            Health = 4;
            AddManaCost(ElementType.Water, 3);
        }
        public override void SetNaturalAffects(ICollector<Affect> affects) {
            affects.Add<Affects.Flight>();
            affects.Add<MantaraAffect>();
        }

        private class MantaraAffect: ConditionalAffect {
            public MantaraAffect() {}

            public override string Id {
                get { return "mantara"; }
            }

            protected override bool IsEnabled() {
                return Owner.HasFlag<Affects.Deluge>();
            }

            protected override void AddAffects() {
                Add(new Affects.Regeneration(2));
            }

            protected override void RegisterEvents() {
                Owner.GlobalSummary.OnUpdateAura += Update;
            }

            protected override void UnregisterEvents() {
                Owner.GlobalSummary.OnUpdateAura -= Update;
            }
        }
    }
}
